package org.finesys.common.redisson.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.concurrent.TimeUnit;

@Data
@Accessors(chain = true)
@NoArgsConstructor
public class LockEntity {
    /**
     * 锁名称，适用于公平锁、读写锁、重入锁
     */
    private String lockName;
    /**
     * 尝试加锁等待时间
     */
    private long waitTime = 60L;
    /**
     * 上锁时间
     */
    private long leaseTime = 60;
    /**
     * 时间单位,默认为秒
     */
    TimeUnit timeUnit = TimeUnit.SECONDS;
    /**
     * 多个key集合,适用于连锁、红锁
     */
    private List<String> keyList;

    public LockEntity(String lockName) {
        this.lockName = lockName;
    }
}
